#include "mutexlock.h"

MutexLock::MutexLock()
{
    // 线程锁初始化
    pthread_mutex_init(& this->mutx, nullptr);
}

MutexLock::~MutexLock()
{
    pthread_mutex_lock(& this->mutx);
    pthread_mutex_destroy(& this->mutx);
}

void MutexLock::lock()
{
    pthread_mutex_lock(& this->mutx);
}

void MutexLock::unlock()
{
    pthread_mutex_unlock(& this->mutx);
}

pthread_mutex_t *MutexLock::get()
{
    return &this->mutx;
}
